// 集装箱流转
import { normalDayFormat, normalHourMinuteFormat } from "@/utils/formatData";
export const containerCirculationVo = (list: any) => {
  if (!list || list.length === 0) return [];
  const _list: any = [];
  list.forEach((item: any) => {
    _list.push(containerCirculationOne(item));
  });

  return _list;
};
export const containerCirculationOne = (item: any) => {
  // 预计到港时间
  item.provisionCabinetTimeVo = "";
  if (item.provisionCabinetTime && item.provisionCabinetTime !== "") {
    item.provisionCabinetTimeVo = normalDayFormat(item.provisionCabinetTime);
  }

  item.statusFlag = "";
  if (item.status === 0) {
    // 待指派车队
    item.statusFlag = "waitAppointFleet";
  }
  if (item.status === 1) {
    // 待车队确认接单
    item.statusFlag = "waitFleetSure";
  }
  if (item.status === 2) {
    // 车队确认接单 待指派司机
    item.statusFlag = "waitAppointDriver";
  }
  if (item.status === 3) {
    // 车队拒绝接单
    item.statusFlag = "fleetRefund";
  }
  if (item.status === 4) {
    // 车队指定司机 待司机确认接单
    item.statusFlag = "waitDriverSure";
  }
  if (item.status === 5) {
    // 司机确认接单 待提柜
    item.statusFlag = "waitPickUp";
  }
  if (item.status === 6) {
    // 司机拒绝接单
    item.statusFlag = "driverRefund";
  }
  if (item.status === 7) {
    // 司机提柜完成 配送中
    item.statusFlag = "driverPickUp";
  }
  if (item.status === 8) {
    // 司机配送完成
    item.statusFlag = "driverDelivery";
  }
  if (item.status === 9) {
    // 仓库卸货完成 待还柜
    item.statusFlag = "warehouseUnLoad";
    if (item.returnStatus === 1) {
      // 预约还柜 待分配还柜司机
      item.statusFlag = "appointReturn";
    }
    if (item.returnStatus === 2) {
      // 已分配还柜司机 待还柜
      item.statusFlag = "waitReturnCabinet";
    }
    if (item.returnStatus === 3) {
      // 还柜完成
      item.statusFlag = "returnCabinet";
    }
  }

  return item;
};
